package com.ymatou.iapi.trading.ordersync.testcase;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Random;

import org.json.JSONArray;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.iapi.settlement.service.SettlementService;
import com.ymatou.iapi.trading.operate.parameter.BargainGroupService;
import com.ymatou.iapi.trading.operate.parameter.Order;
import com.ymatou.iapi.trading.operate.parameter.OrderInfoPo;
import com.ymatou.iapi.trading.operate.parameter.OrderItemVo;
import com.ymatou.iapi.trading.operate.parameter.PlaceOrderResp;
import com.ymatou.iapi.trading.operate.parameter.PlaceOrderService;
import com.ymatou.iapi.trading.operate.parameter.enums.LogisticsTypeEnum;
import com.ymatou.iapi.trading.operate.parameter.enums.PlatformEnum;
import com.ymatou.iapi.trading.operate.parameter.po.SubcatalogsPo;
import com.ymatou.iapi.trading.operate.parameter.req.ApplySalesRefundRequestBean;
import com.ymatou.iapi.trading.operate.parameter.req.ChangeOrderDiscountBean;
import com.ymatou.iapi.trading.operate.parameter.req.OrderPayRequestBean;
import com.ymatou.iapi.trading.operate.parameter.req.PlaceOrderReq;
import com.ymatou.iapi.trading.operate.service.ChangeOrderDiscountCall;
import com.ymatou.iapi.trading.operate.service.OrderPayRequestCall;
import com.ymatou.iapi.trading.operate.service.PlaceOrderCall;
import com.ymatou.iapi.trading.ordersync.parameter.OrderBean;
import com.ymatou.iapi.trading.ordersync.parameter.OrderSyncCmdEnum;
import com.ymatou.iapi.trading.ordersync.parameter.SyncOrderCmdBean;
import com.ymatou.iapi.trading.ordersync.service.SyncOrderCmdCall;
import com.ymatou.iapi.trading.ordersync.service.SyncVerifyService;
import com.ymt.base.YmatouEasyCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.annotation.TestSuite;
import com.ymt.utils.tag.P1;
import com.ymt.utils.tag.P2;
import com.ymttest.business.service.OrderCallService;
import com.ymttest.business.service.PaymentProxyCallService;
import com.ymttest.database.sqlwapper.DefaultWapper;
import com.ymttest.database.sqlwapper.YmtProductsIWapper;
import com.ymttest.utils.TestDataManager;
import com.ymttest.utils.YMTDateUtil;

/**
 * 同步指令接口 FreeMaker Template自动生成代码
 */
@TestSuite
public class Ts_SyncOrderCmd {
	private static SyncOrderCmdBean syncOrderCmdBean;
	private static SyncOrderCmdCall syncOrderCmdCall;

	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("同步指令接口");
	}

	@Before
	public void caseUp() {
		syncOrderCmdBean = new SyncOrderCmdBean();
		syncOrderCmdCall = new SyncOrderCmdCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(syncOrderCmdCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}

	/**
	 * 
	 * 组合商品订单
	 * 
	 * 不使用优惠券，商家优惠
	 * 
	 */
	private static PlaceOrderResp placeOrder2() {

		PlaceOrderResp orderResp = new PlaceOrderResp();
		PlaceOrderReq placeorderBean = new PlaceOrderReq();
		PlaceOrderCall placeorderCall = new PlaceOrderCall();

		try {

			SubcatalogsPo subcatalogsPo = new YmtProductsIWapper()
					.getSubcatalogs();

			SubcatalogsPo subcatalogsPo2 = new YmtProductsIWapper()
					.getSubcatalogs();

			//组合商品
			String catalogId = subcatalogsPo.getCatalogId();

			placeorderBean = PlaceOrderService.getDefaultOrderReq();

			OrderItemVo OrderItemVo = placeorderBean.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			OrderItemVo.setCatalogId(catalogId);

			OrderItemVo.setSubProduct(true);

			OrderItemVo.setFreight(new BigDecimal(new Random().nextInt(100)));

			OrderItemVo OrderItemVo2 = PlaceOrderService
					.getDefaultOrderItemVo();

			OrderItemVo2.setCatalogId(subcatalogsPo2.getCatalogId());

			OrderItemVo2.setFreight(new BigDecimal(new Random().nextInt(100)));

			OrderItemVo2.setSubProduct(true);

			placeorderBean.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(OrderItemVo2);

			placeorderBean.getOrderGroups().get(0).setSellerCoupon(null);

			placeorderBean.setYmatouCoupon(null);

			placeorderCall.setData(false, placeorderBean);

			placeorderCall.callService();

			JSONArray orderArray = placeorderCall.getOrderIds();

			List<Order> orderList = new ArrayList<Order>();

			for (int i = 0; i < orderArray.length(); i++) {

				Order order = new Order();
				int orderId = orderArray.getInt(i);

				List<Map> maps = new DefaultWapper()
						.executeSql("select iBuyerId from ymt_orders where iOrderId="
								+ orderId);

				List<OrderInfoPo> orderInfoList = new DefaultWapper()
						.selectOrderInfoByOrderId2(orderId);

				order.setOrderInfoList(orderInfoList);

				order.setOrderId(orderId);
				order.setSellerId((Integer) maps.get(0).get("iBuyerId"));

				orderList.add(order);
			}

			int tradingId = placeorderCall.getTradingId();
			// 根据交易号计算需要支付的金额
			BigDecimal payAmount = new OrderCallService()
					.getNeedPrePayAmountOfCashBymainOrderId(tradingId);

			orderResp.setTradingId(tradingId);
			orderResp.setOrderList(orderList);
			orderResp.setPayAmount(payAmount);
			orderResp.setUserId(placeorderBean.getUserId());

		} catch (Exception e) {
			Logger.fail(e);
		}
		return orderResp;
	}

	@Test
	@Category(P1.class)
	@TestCase
	@Ignore
	public void Tc_SyncOrderCmd_000() {
		Logger.start(true, "Test");
		Logger.debug("360419:"
				+ SyncVerifyService.getOrderFromES(360419).getAcpTm());
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_SyncOrderCmd_001() {
		Logger.start(true, "PLACE指令调用成功,验证数据");
		try {
			// 创建订单
			Logger.comment("前置数据准备");

			PlaceOrderResp placeOrder = PlaceOrderService.placeOrder3();

			int userId = placeOrder.getUserId();
			int sellerId = placeOrder.getOrderList().get(0).getSellerId();
			int tradingId = placeOrder.getTradingId();
			Integer orderId = placeOrder.getOrderList().get(0).getOrderId();

			Logger.comment("前置数据准备结束");
			//Thread.sleep(2000);

			syncOrderCmdBean.setCmdReqId(TestDataManager.getRandomUUID()
					.toString());
			syncOrderCmdBean.setOrderId(orderId);

			syncOrderCmdBean.setCommand(OrderSyncCmdEnum.PLACE.toString());

			syncOrderCmdCall.setData(syncOrderCmdBean);
			syncOrderCmdCall.callService();

			Thread.sleep(2000);

			Logger.verifyIsContains("ok", syncOrderCmdCall.getReturnData(),
					"验证返回结果");

			SyncVerifyService.verify(orderId, userId, sellerId);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_SyncOrderCmd_002() {
		Logger.start(true, "PAY指令调用成功,验证数据");
		try {
			// 创建订单
			Logger.comment("前置数据准备");
			PlaceOrderResp placeOrder = PlaceOrderService.placeOrder3();
			int userId = placeOrder.getUserId();
			int sellerId = placeOrder.getOrderList().get(0).getSellerId();

			int tradingId = placeOrder.getTradingId();
			Integer orderId = placeOrder.getOrderList().get(0).getOrderId();
			Logger.comment("前置数据准备结束");

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.PLACE);

			OrderCallService orderCallService = new OrderCallService();
			// 应付款全金额
			BigDecimal totalPrice = orderCallService
					.getNeedPrePayAmountOfCashBymainOrderId(tradingId);
			// 支付订单
			orderCallService.orderPayRequest(userId, totalPrice, tradingId);

			syncOrderCmdBean.setCmdReqId(TestDataManager.getRandomUUID()
					.toString());
			syncOrderCmdBean.setOrderId(orderId);

			syncOrderCmdBean.setCommand(OrderSyncCmdEnum.PAY.toString());
			syncOrderCmdCall.setData(syncOrderCmdBean);
			syncOrderCmdCall.callService();

			Logger.verifyIsContains("ok", syncOrderCmdCall.getReturnData(),
					"验证返回结果");

			SyncVerifyService.verify(orderId, userId, sellerId);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_SyncOrderCmd_003() {
		Logger.start(true, "订单付款之前CANCEL指令调用成功,验证数据");
		try {
			// 创建订单
			Logger.comment("前置数据准备");
			PlaceOrderResp placeOrder = PlaceOrderService.placeOrder3();
			int userId = placeOrder.getUserId();
			int sellerId = placeOrder.getOrderList().get(0).getSellerId();

			int tradingId = placeOrder.getTradingId();
			Integer orderId = placeOrder.getOrderList().get(0).getOrderId();
			Logger.comment("前置数据准备结束");

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.PLACE);

			OrderCallService orderCallService = new OrderCallService();
			// 取消订单
			orderCallService.cancelOrder(orderId, userId);

			syncOrderCmdBean.setCmdReqId(TestDataManager.getRandomUUID()
					.toString());
			syncOrderCmdBean.setOrderId(orderId);

			syncOrderCmdBean.setCommand(OrderSyncCmdEnum.CANCEL.toString());
			syncOrderCmdCall.setData(syncOrderCmdBean);
			syncOrderCmdCall.callService();

			Logger.verifyIsContains("ok", syncOrderCmdCall.getReturnData(),
					"验证返回结果");

			SyncVerifyService.verify(orderId, userId, sellerId);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_SyncOrderCmd_004() {
		Logger.start(true, "订单付款之后CANCEL指令调用成功,验证数据");
		try {
			// 创建订单
			Logger.comment("前置数据准备");
			PlaceOrderResp placeOrder = PlaceOrderService.placeOrder3();
			int userId = placeOrder.getUserId();
			int sellerId = placeOrder.getOrderList().get(0).getSellerId();

			int tradingId = placeOrder.getTradingId();
			Integer orderId = placeOrder.getOrderList().get(0).getOrderId();
			Logger.comment("前置数据准备结束");

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.PLACE);

			OrderCallService orderCallService = new OrderCallService();
			// 应付款全金额
			BigDecimal totalPrice = orderCallService
					.getNeedPrePayAmountOfCashBymainOrderId(tradingId);
			// 支付订单
			orderCallService.orderPayRequest(userId, totalPrice, tradingId);

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.PAY);
			// 取消订单
			orderCallService.cancelOrder(orderId, userId);

			syncOrderCmdBean.setCmdReqId(TestDataManager.getRandomUUID()
					.toString());
			syncOrderCmdBean.setOrderId(orderId);

			syncOrderCmdBean.setCommand(OrderSyncCmdEnum.CANCEL.toString());
			syncOrderCmdCall.setData(syncOrderCmdBean);
			syncOrderCmdCall.callService();

			Logger.verifyIsContains("ok", syncOrderCmdCall.getReturnData(),
					"验证返回结果");

			SyncVerifyService.verify(orderId, userId, sellerId);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_SyncOrderCmd_005() {
		Logger.start(true, "CHANGE_ADDRESS指令调用成功,验证数据");
		try {
			// 创建订单
			Logger.comment("前置数据准备");
			PlaceOrderResp placeOrder = PlaceOrderService.placeOrder3();
			int userId = placeOrder.getUserId();
			int sellerId = placeOrder.getOrderList().get(0).getSellerId();

			int tradingId = placeOrder.getTradingId();
			Integer orderId = placeOrder.getOrderList().get(0).getOrderId();
			Logger.comment("前置数据准备结束");

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.PLACE);
			OrderCallService orderCallService = new OrderCallService();
			// 应付款全金额
			BigDecimal totalPrice = orderCallService
					.getNeedPrePayAmountOfCashBymainOrderId(tradingId);
			// 支付订单
			orderCallService.orderPayRequest(userId, totalPrice, tradingId);

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.PLACE);
			// 接单
			orderCallService.acceptOrder(orderId, sellerId);

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.ACCEPT);
			// 发货
			SyncVerifyService.dispatched(orderId, sellerId);

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.DELIVERY);
			// 修改地址
			YmatouEasyCall YmatouEasyCall = new YmatouEasyCall("", "POST",
					"JSON");
			OrderBean order = new OrderBean();
			String orderJson = "{\"OrderId\":"
					+ orderId
					+ ",\"UserId\":"
					+ userId
					+ ",\"Address\":\"南京路步行街\",\"PostCode\":\"986574\",\"ReceievePerson\":\"洋码头\",\"Phone\":\"13200000005\",\"Telephone\":\"021-51025140\",\"QQ\":\"100001\",\"Email\":\"Hj02QUQuEXmk@sohu.com\",\"UserType\":\"Normal\",\"ChangeTime\":\"2016-12-26 10:57:26\"}";
			YmatouEasyCall
					.setUrl("http://operate.trading.iapi.ymatou.com/api/Buyer/ChangeOrderAddress");
			YmatouEasyCall.setData(orderJson);
			YmatouEasyCall.callService();
			syncOrderCmdBean.setCmdReqId(TestDataManager.getRandomUUID()
					.toString());
			syncOrderCmdBean.setOrderId(orderId);

			syncOrderCmdBean.setCommand(OrderSyncCmdEnum.CHANGE_ADDRESS
					.toString());
			syncOrderCmdCall.setData(syncOrderCmdBean);
			syncOrderCmdCall.callService();

			Logger.verifyIsContains("ok", syncOrderCmdCall.getReturnData(),
					"验证返回结果");

			SyncVerifyService.verify(orderId, userId, sellerId);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_SyncOrderCmd_006() {
		Logger.start(true, "DELETE指令调用成功,验证数据");
		try {
			// 创建订单
			Logger.comment("前置数据准备");
			PlaceOrderResp placeOrder = PlaceOrderService.placeOrder3();
			int userId = placeOrder.getUserId();
			int sellerId = placeOrder.getOrderList().get(0).getSellerId();

			int tradingId = placeOrder.getTradingId();
			Integer orderId = placeOrder.getOrderList().get(0).getOrderId();
			Logger.comment("前置数据准备结束");

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.PLACE);
			OrderCallService orderCallService = new OrderCallService();
			// 应付款全金额
			BigDecimal totalPrice = orderCallService
					.getNeedPrePayAmountOfCashBymainOrderId(tradingId);
			// 支付订单
			orderCallService.orderPayRequest(userId, totalPrice, tradingId);

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.PAY);
			// 删除订单
			YmatouEasyCall YmatouEasyCall = new YmatouEasyCall("", "POST",
					"JSON");
			OrderBean order = new OrderBean();
			String orderJson = "{\"orderId\":" + orderId
					+ ",\"isDelete\":true,\"userId\":" + userId + "}";
			YmatouEasyCall
					.setUrl("http://operate.trading.iapi.ymatou.com/api/Buyer/markOrderDeleted");
			YmatouEasyCall.setData(orderJson);
			YmatouEasyCall.callService();
			syncOrderCmdBean.setCmdReqId(TestDataManager.getRandomUUID()
					.toString());
			syncOrderCmdBean.setOrderId(orderId);

			syncOrderCmdBean.setCommand(OrderSyncCmdEnum.DELETE.toString());
			syncOrderCmdCall.setData(syncOrderCmdBean);
			syncOrderCmdCall.callService();

			Logger.verifyIsContains("ok", syncOrderCmdCall.getReturnData(),
					"验证返回结果");

			SyncVerifyService.verify(orderId, userId, sellerId);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_SyncOrderCmd_007() {
		Logger.start(true, "CHANGE_DISCOUNT指令调用成功,验证数据");
		try {
			// 创建订单
			Logger.comment("前置数据准备");
			PlaceOrderResp placeOrderResp = new OrderCallService()
					.createM2cOrder();

			int orderId = placeOrderResp.getOrderList().get(0).getOrderId();
			int sellerId = placeOrderResp.getOrderList().get(0).getSellerId();
			int userId = placeOrderResp.getUserId();
			int tradingId = placeOrderResp.getTradingId();

			Logger.comment("前置数据准备结束");

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.PLACE);

			// 调整订单折扣
			SyncVerifyService.changeOrderDiscount(orderId, sellerId);

			syncOrderCmdBean.setCmdReqId(TestDataManager.getRandomUUID()
					.toString());
			syncOrderCmdBean.setOrderId(orderId);

			syncOrderCmdBean.setCommand(OrderSyncCmdEnum.CHANGE_DISCOUNT
					.toString());
			syncOrderCmdCall.setData(syncOrderCmdBean);
			syncOrderCmdCall.callService();

			Logger.verifyIsContains("ok", syncOrderCmdCall.getReturnData(),
					"验证返回结果");

			SyncVerifyService.verify(orderId, userId, sellerId);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_SyncOrderCmd_008() {
		Logger.start(true, "ACCEPT指令调用成功,验证数据");
		try {
			// 创建订单
			Logger.comment("前置数据准备");
			PlaceOrderResp placeOrder = PlaceOrderService.placeOrder3();
			int userId = placeOrder.getUserId();
			int sellerId = placeOrder.getOrderList().get(0).getSellerId();

			int tradingId = placeOrder.getTradingId();
			Integer orderId = placeOrder.getOrderList().get(0).getOrderId();
			Logger.comment("前置数据准备结束");

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.PLACE);
			OrderCallService orderCallService = new OrderCallService();
			// 应付款全金额
			BigDecimal totalPrice = orderCallService
					.getNeedPrePayAmountOfCashBymainOrderId(tradingId);
			// 支付订单
			orderCallService.orderPayRequest(userId, totalPrice, tradingId);

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.PAY);
			// 接单
			orderCallService.acceptOrder(orderId, sellerId);
			syncOrderCmdBean.setCmdReqId(TestDataManager.getRandomUUID()
					.toString());
			syncOrderCmdBean.setOrderId(orderId);

			syncOrderCmdBean.setCommand(OrderSyncCmdEnum.ACCEPT.toString());
			syncOrderCmdCall.setData(syncOrderCmdBean);
			syncOrderCmdCall.callService();

			Logger.verifyIsContains("ok", syncOrderCmdCall.getReturnData(),
					"验证返回结果");

			SyncVerifyService.verify(orderId, userId, sellerId);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_SyncOrderCmd_009() {
		Logger.start(true, "DELIVERY指令调用成功,验证数据");
		try {
			// 创建订单
			Logger.comment("前置数据准备");
			PlaceOrderResp placeOrder = PlaceOrderService.placeOrder3();
			int userId = placeOrder.getUserId();
			int sellerId = placeOrder.getOrderList().get(0).getSellerId();

			int tradingId = placeOrder.getTradingId();
			Integer orderId = placeOrder.getOrderList().get(0).getOrderId();
			Logger.comment("前置数据准备结束");

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.PLACE);
			OrderCallService orderCallService = new OrderCallService();
			// 应付款全金额
			BigDecimal totalPrice = orderCallService
					.getNeedPrePayAmountOfCashBymainOrderId(tradingId);
			// 支付订单
			orderCallService.orderPayRequest(userId, totalPrice, tradingId);

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.PAY);
			// 接单
			orderCallService.acceptOrder(orderId, sellerId);

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.ACCEPT);
			// 发货
			SyncVerifyService.dispatched(orderId, sellerId);

			syncOrderCmdBean.setCmdReqId(TestDataManager.getRandomUUID()
					.toString());
			syncOrderCmdBean.setOrderId(orderId);

			syncOrderCmdBean.setCommand(OrderSyncCmdEnum.DELIVERY.toString());
			syncOrderCmdCall.setData(syncOrderCmdBean);
			syncOrderCmdCall.callService();

			Logger.verifyIsContains("ok", syncOrderCmdCall.getReturnData(),
					"验证返回结果");

			SyncVerifyService.verify(orderId, userId, sellerId);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_SyncOrderCmd_010() {
		Logger.start(true, "CUSTOMS_CLEAR指令调用成功,验证数据");
		try {
			Logger.comment("前置数据准备");
			PlaceOrderResp placeOrderResp = new OrderCallService()
					.createM2cOrder();

			int orderId = placeOrderResp.getOrderList().get(0).getOrderId();
			int sellerId = placeOrderResp.getOrderList().get(0).getSellerId();
			int userId = placeOrderResp.getUserId();
			int tradingId = placeOrderResp.getTradingId();

			Logger.comment("前置数据准备结束");

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.PLACE);
			OrderCallService orderCallService = new OrderCallService();
			// 应付款全金额
			BigDecimal totalPrice = orderCallService
					.getNeedPrePayAmountOfCashBymainOrderId(tradingId);
			// 支付订单
			orderCallService.orderPayRequest(userId, totalPrice, tradingId);

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.PAY);
			// 接单
			orderCallService.acceptOrder(orderId, sellerId);

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.ACCEPT);

			// 保存物流信息
			String billCode = SyncVerifyService.dispatched(orderId, sellerId);

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.DELIVERY);
			// 同步国内发货信息
			YmatouEasyCall YmatouEasyCall = new YmatouEasyCall("", "POST",
					"JSON");
			OrderBean order = new OrderBean();
			String orderJson = "{\"logisticsNos\":[\"" + billCode + "\"]}";
			YmatouEasyCall
					.setUrl("http://operate.trading.iapi.ymatou.com/api/Notify/SyncOrderLogisticStatus");
			YmatouEasyCall.setData(orderJson);
			YmatouEasyCall.callService();

			syncOrderCmdBean.setCmdReqId(TestDataManager.getRandomUUID()
					.toString());
			syncOrderCmdBean.setOrderId(orderId);

			syncOrderCmdBean.setCommand(OrderSyncCmdEnum.CUSTOMS_CLEAR
					.toString());
			syncOrderCmdCall.setData(syncOrderCmdBean);
			syncOrderCmdCall.callService();

			Logger.verifyIsContains("ok", syncOrderCmdCall.getReturnData(),
					"验证返回结果");

			SyncVerifyService.verify(orderId, userId, sellerId);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_SyncOrderCmd_011() {
		Logger.start(true, "DELIVERY_LOCAL指令调用成功,验证数据");
		try {
			// 创建订单
			Logger.comment("前置数据准备");
			PlaceOrderResp placeOrder = PlaceOrderService.placeOrder3();
			int userId = placeOrder.getUserId();
			int sellerId = placeOrder.getOrderList().get(0).getSellerId();

			int tradingId = placeOrder.getTradingId();
			Integer orderId = placeOrder.getOrderList().get(0).getOrderId();
			Logger.comment("前置数据准备结束");

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.PLACE);

			OrderCallService orderCallService = new OrderCallService();
			// 应付款全金额
			BigDecimal totalPrice = orderCallService
					.getNeedPrePayAmountOfCashBymainOrderId(tradingId);
			// 支付订单
			orderCallService.orderPayRequest(userId, totalPrice, tradingId);

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.PAY);

			// 接单
			orderCallService.acceptOrder(orderId, sellerId);

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.ACCEPT);
			// 发货
			// 商家发货
			SyncVerifyService.dispatched(orderId, sellerId);

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.DELIVERY);
			// 同步国内发货信息
			YmatouEasyCall YmatouEasyCall = new YmatouEasyCall("", "POST",
					"JSON");
			OrderBean order = new OrderBean();
			String orderJson = "{\"OrderId\":"
					+ orderId
					+ ",\"LogisticsNo\":\"autotest_123456\",\"Weight\":2,\"LogisticsCompany\":\"码头自动化测试物流\"}";
			YmatouEasyCall
					.setUrl("http://operate.trading.iapi.ymatou.com/api/Notify/SyncDomesticDeliveredInfo");
			YmatouEasyCall.setData(orderJson);
			YmatouEasyCall.callService();

			syncOrderCmdBean.setCmdReqId(TestDataManager.getRandomUUID()
					.toString());
			syncOrderCmdBean.setOrderId(orderId);

			syncOrderCmdBean.setCommand(OrderSyncCmdEnum.DELIVERY_LOCAL
					.toString());
			syncOrderCmdCall.setData(syncOrderCmdBean);
			syncOrderCmdCall.callService();

			Logger.verifyIsContains("ok", syncOrderCmdCall.getReturnData(),
					"验证返回结果");

			SyncVerifyService.verify(orderId, userId, sellerId);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_SyncOrderCmd_012() {
		Logger.start(true, "DELIVERY_ROLLBACK指令调用成功,验证数据");
		try {
			// 创建订单
			Logger.comment("前置数据准备");
			PlaceOrderResp placeOrder = PlaceOrderService.placeOrder3();
			int userId = placeOrder.getUserId();
			int sellerId = placeOrder.getOrderList().get(0).getSellerId();

			int tradingId = placeOrder.getTradingId();
			Integer orderId = placeOrder.getOrderList().get(0).getOrderId();
			Logger.comment("前置数据准备结束");

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.PLACE);
			OrderCallService orderCallService = new OrderCallService();
			// 应付款全金额
			BigDecimal totalPrice = orderCallService
					.getNeedPrePayAmountOfCashBymainOrderId(tradingId);
			// 支付订单
			orderCallService.orderPayRequest(userId, totalPrice, tradingId);

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.PAY);

			// 接单
			orderCallService.acceptOrder(orderId, sellerId);

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.ACCEPT);

			// 商家发货
			SyncVerifyService.dispatched(orderId, sellerId);

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.DELIVERY);

			// 同步国内发货信息
			YmatouEasyCall YmatouEasyCall = new YmatouEasyCall("", "POST",
					"JSON");
			OrderBean order = new OrderBean();
			String orderJson = "{\"orderId\":"
					+ orderId
					+ ",\"operateUser\":\"autotest\",\"reason\":\"autotest rollbac\"}";
			YmatouEasyCall
					.setUrl("http://operate.trading.iapi.ymatou.com/api/Common/RollbackToWaitDelivery");
			YmatouEasyCall.setData(orderJson);
			YmatouEasyCall.callService();

			syncOrderCmdBean.setCmdReqId(TestDataManager.getRandomUUID()
					.toString());
			syncOrderCmdBean.setOrderId(orderId);

			syncOrderCmdBean.setCommand(OrderSyncCmdEnum.DELIVERY_ROLLBACK
					.toString());
			syncOrderCmdCall.setData(syncOrderCmdBean);
			syncOrderCmdCall.callService();

			Logger.verifyIsContains("ok", syncOrderCmdCall.getReturnData(),
					"验证返回结果");

			SyncVerifyService.verify(orderId, userId, sellerId);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_SyncOrderCmd_013() {
		Logger.start(true, "EVALUATE指令调用成功,验证数据");
		try {
			// 创建订单
			Logger.comment("前置数据准备");
			PlaceOrderResp placeOrder = PlaceOrderService.placeOrder3();
			int userId = placeOrder.getUserId();
			int sellerId = placeOrder.getOrderList().get(0).getSellerId();

			int tradingId = placeOrder.getTradingId();
			Integer orderId = placeOrder.getOrderList().get(0).getOrderId();
			Logger.comment("前置数据准备结束");

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.PLACE);

			OrderCallService orderCallService = new OrderCallService();
			// 应付款全金额
			BigDecimal totalPrice = orderCallService
					.getNeedPrePayAmountOfCashBymainOrderId(tradingId);
			// 支付订单
			orderCallService.orderPayRequest(userId, totalPrice, tradingId);

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.PAY);

			// 接单
			orderCallService.acceptOrder(orderId, sellerId);

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.ACCEPT);

			// 商家发货
			SyncVerifyService.dispatched(orderId, sellerId);

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.DELIVERY);

			// 评价
			YmatouEasyCall YmatouEasyCall = new YmatouEasyCall("", "POST",
					"JSON");
			OrderBean order = new OrderBean();
			String orderJson = "{\"orderId\":" + orderId + ",\"cancle\":false}";
			YmatouEasyCall
					.setUrl("http://operate.trading.iapi.ymatou.com/api/Buyer/markOrderEvaluated");
			YmatouEasyCall.setData(orderJson);
			YmatouEasyCall.callService();

			syncOrderCmdBean.setCmdReqId(TestDataManager.getRandomUUID()
					.toString());
			syncOrderCmdBean.setOrderId(orderId);

			syncOrderCmdBean.setCommand(OrderSyncCmdEnum.EVALUATE.toString());
			syncOrderCmdCall.setData(syncOrderCmdBean);
			syncOrderCmdCall.callService();

			Logger.verifyIsContains("ok", syncOrderCmdCall.getReturnData(),
					"验证返回结果");

			SyncVerifyService.verify(orderId, userId, sellerId);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_SyncOrderCmd_014() {
		Logger.start(true, "DELAY_RECV指令调用成功,验证数据");
		try {
			// 创建订单
			Logger.comment("前置数据准备");
			PlaceOrderResp placeOrder = PlaceOrderService.placeOrder3();
			int userId = placeOrder.getUserId();
			int sellerId = placeOrder.getOrderList().get(0).getSellerId();

			int tradingId = placeOrder.getTradingId();
			Integer orderId = placeOrder.getOrderList().get(0).getOrderId();
			Logger.comment("前置数据准备结束");

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.PLACE);

			OrderCallService orderCallService = new OrderCallService();
			// 应付款全金额
			BigDecimal totalPrice = orderCallService
					.getNeedPrePayAmountOfCashBymainOrderId(tradingId);
			// 支付订单
			orderCallService.orderPayRequest(userId, totalPrice, tradingId);

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.PAY);

			// 接单
			orderCallService.acceptOrder(orderId, sellerId);

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.ACCEPT);

			// 发货
			SyncVerifyService.dispatched(orderId, sellerId);

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.DELIVERY);

			// 延长收货
			YmatouEasyCall YmatouEasyCall = new YmatouEasyCall("", "POST",
					"JSON");
			OrderBean order = new OrderBean();
			String orderJson = "{\"OrderId\":"
					+ orderId
					+ ",\"OperateUserId\":"
					+ userId
					+ ",\"DelayDay\":1,\"Remark\":\"自动化测试延长信息\",\"OperateUserType\":0}";
			YmatouEasyCall
					.setUrl("http://operate.trading.iapi.ymatou.com/api/Common/DelayReceive");
			YmatouEasyCall.setData(orderJson);
			YmatouEasyCall.callService();
			syncOrderCmdBean.setCmdReqId(TestDataManager.getRandomUUID()
					.toString());
			syncOrderCmdBean.setOrderId(orderId);

			syncOrderCmdBean.setCommand(OrderSyncCmdEnum.DELAY_RECV.toString());
			syncOrderCmdCall.setData(syncOrderCmdBean);
			syncOrderCmdCall.callService();

			Logger.verifyIsContains("ok", syncOrderCmdCall.getReturnData(),
					"验证返回结果");

			SyncVerifyService.verify(orderId, userId, sellerId);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_SyncOrderCmd_015() {
		Logger.start(true, "RECEIVE指令调用成功,验证数据");
		try {
			// 创建订单
			Logger.comment("前置数据准备");
			PlaceOrderResp placeOrder = PlaceOrderService.placeOrder3();
			int userId = placeOrder.getUserId();
			int sellerId = placeOrder.getOrderList().get(0).getSellerId();

			int tradingId = placeOrder.getTradingId();
			Integer orderId = placeOrder.getOrderList().get(0).getOrderId();
			Logger.comment("前置数据准备结束");

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.PLACE);

			OrderCallService orderCallService = new OrderCallService();
			// 应付款全金额
			BigDecimal totalPrice = orderCallService
					.getNeedPrePayAmountOfCashBymainOrderId(tradingId);
			// 支付订单
			orderCallService.orderPayRequest(userId, totalPrice, tradingId);

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.PAY);

			// 接单
			orderCallService.acceptOrder(orderId, sellerId);

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.ACCEPT);

			// 发货
			SyncVerifyService.dispatched(orderId, sellerId);

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.DELIVERY);

			// 确认收货
			orderCallService.confirmReceive(userId, orderId);

			syncOrderCmdBean.setCmdReqId(TestDataManager.getRandomUUID()
					.toString());
			syncOrderCmdBean.setOrderId(orderId);

			syncOrderCmdBean.setCommand(OrderSyncCmdEnum.RECEIVE.toString());
			syncOrderCmdCall.setData(syncOrderCmdBean);
			syncOrderCmdCall.callService();

			Logger.verifyIsContains("ok", syncOrderCmdCall.getReturnData(),
					"验证返回结果");

			SyncVerifyService.verify(orderId, userId, sellerId);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_SyncOrderCmd_016() {
		Logger.start(true, "CHANGE_IDCARD指令调用成功,验证数据");
		try {
			// 创建订单
			Logger.comment("前置数据准备");
			PlaceOrderResp placeOrder = PlaceOrderService.placeOrder3();
			int userId = placeOrder.getUserId();
			int sellerId = placeOrder.getOrderList().get(0).getSellerId();

			int tradingId = placeOrder.getTradingId();
			Integer orderId = placeOrder.getOrderList().get(0).getOrderId();
			Logger.comment("前置数据准备结束");

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.PLACE);

			OrderCallService orderCallService = new OrderCallService();
			// 应付款全金额
			BigDecimal totalPrice = orderCallService
					.getNeedPrePayAmountOfCashBymainOrderId(tradingId);
			// 支付订单
			orderCallService.orderPayRequest(userId, totalPrice, tradingId);

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.PAY);
			// 接单
			orderCallService.acceptOrder(orderId, sellerId);

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.ACCEPT);

			// 商家发货
			SyncVerifyService.dispatched(orderId, sellerId);

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.DELIVERY);

			// 订单通知修改地址
			YmatouEasyCall YmatouEasyCall = new YmatouEasyCall("", "POST",
					"JSON");
			OrderBean order = new OrderBean();
			String orderJson = "{\"orderId\":" + orderId
					+ ",\"businessType\":15}";
			YmatouEasyCall
					.setUrl("http://operate.trading.iapi.ymatou.com/api/Notify/OrderAsyncNotify");
			YmatouEasyCall.setData(orderJson);
			YmatouEasyCall.callService();

			syncOrderCmdBean.setCmdReqId(TestDataManager.getRandomUUID()
					.toString());
			syncOrderCmdBean.setOrderId(orderId);

			syncOrderCmdBean.setCommand(OrderSyncCmdEnum.CHANGE_IDCARD
					.toString());
			syncOrderCmdCall.setData(syncOrderCmdBean);
			syncOrderCmdCall.callService();

			Logger.verifyIsContains("ok", syncOrderCmdCall.getReturnData(),
					"验证返回结果");

			SyncVerifyService.verify(orderId, userId, sellerId);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_SyncOrderCmd_017() {
		Logger.start(true, "NEW_CUSTOMER_SELLER指令调用成功,验证数据");
		try {
			// 创建订单
			Logger.comment("前置数据准备");
			PlaceOrderResp placeOrder = PlaceOrderService.placeOrder3();
			int userId = placeOrder.getUserId();
			int sellerId = placeOrder.getOrderList().get(0).getSellerId();

			int tradingId = placeOrder.getTradingId();
			Integer orderId = placeOrder.getOrderList().get(0).getOrderId();
			Logger.comment("前置数据准备结束");

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.PLACE);

			OrderCallService orderCallService = new OrderCallService();
			// 应付款全金额
			BigDecimal totalPrice = orderCallService
					.getNeedPrePayAmountOfCashBymainOrderId(tradingId);
			// 支付订单
			orderCallService.orderPayRequest(userId, totalPrice, tradingId);

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.PAY);

			// 订单支付异步响应通知信息
			YmatouEasyCall YmatouEasyCall = new YmatouEasyCall("", "POST",
					"JSON");
			OrderBean order = new OrderBean();
			String orderJson = "{\"orderId\":" + orderId + "}";
			YmatouEasyCall
					.setUrl("http://operate.trading.iapi.ymatou.com/api/trading/onOrderPaid");
			YmatouEasyCall.setData(orderJson);
			YmatouEasyCall.callService();

			syncOrderCmdBean.setCmdReqId(TestDataManager.getRandomUUID()
					.toString());
			syncOrderCmdBean.setOrderId(orderId);

			syncOrderCmdBean.setCommand(OrderSyncCmdEnum.NEW_CUSTOMER_SELLER
					.toString());
			syncOrderCmdCall.setData(syncOrderCmdBean);
			syncOrderCmdCall.callService();

			Logger.verifyIsContains("ok", syncOrderCmdCall.getReturnData(),
					"验证返回结果");

			SyncVerifyService.verify(orderId, userId, sellerId);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_SyncOrderCmd_018() {
		Logger.start(true, "RISK指令调用成功,验证数据");
		try {
			// 创建订单
			Logger.comment("前置数据准备");
			PlaceOrderResp placeOrder = PlaceOrderService.placeOrder3();
			int userId = placeOrder.getUserId();
			int sellerId = placeOrder.getOrderList().get(0).getSellerId();

			int tradingId = placeOrder.getTradingId();
			Integer orderId = placeOrder.getOrderList().get(0).getOrderId();
			Logger.comment("前置数据准备结束");

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.PLACE);

			OrderCallService orderCallService = new OrderCallService();
			// 应付款全金额
			BigDecimal totalPrice = orderCallService
					.getNeedPrePayAmountOfCashBymainOrderId(tradingId);
			// 支付订单
			orderCallService.orderPayRequest(userId, totalPrice, tradingId);

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.PAY);

			// 订单支付风控系统通知
			YmatouEasyCall YmatouEasyCall = new YmatouEasyCall("", "POST",
					"JSON");
			OrderBean order = new OrderBean();
			/*
			 * 风控检测未通过：{OrderId:105414523,ParamExt:{"Status":"rejected"}}
			 * 风控检测通过：{OrderId:105414517,ParamExt:{"Status":"pass"}}
			 * 风控检测失败：{OrderId:111111,ParamExt:{"Status":"auditing"}}
			 */
			String orderJson = "{\"orderId\":" + orderId
					+ ",\"ParamExt\":{\"Status\":\"rejected\"}}";
			YmatouEasyCall
					.setUrl("http://operate.trading.iapi.ymatou.com/api/Notify/RiskControlNotify");
			YmatouEasyCall.setData(orderJson);
			YmatouEasyCall.callService();

			syncOrderCmdBean.setCmdReqId(TestDataManager.getRandomUUID()
					.toString());
			syncOrderCmdBean.setOrderId(orderId);

			syncOrderCmdBean.setCommand(OrderSyncCmdEnum.RISK.toString());
			syncOrderCmdCall.setData(syncOrderCmdBean);
			syncOrderCmdCall.callService();

			Logger.verifyIsContains("ok", syncOrderCmdCall.getReturnData(),
					"验证返回结果");

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.CANCEL);

			SyncVerifyService.verify(orderId, userId, sellerId);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_SyncOrderCmd_019() {
		Logger.start(true, "REMARK_LEVEL指令调用成功,验证数据");
		try {
			// 创建订单
			Logger.comment("前置数据准备");
			PlaceOrderResp placeOrder = PlaceOrderService.placeOrder3();
			int userId = placeOrder.getUserId();
			int sellerId = placeOrder.getOrderList().get(0).getSellerId();

			int tradingId = placeOrder.getTradingId();
			Integer orderId = placeOrder.getOrderList().get(0).getOrderId();
			Logger.comment("前置数据准备结束");

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.PLACE);

			OrderCallService orderCallService = new OrderCallService();
			// 应付款全金额
			BigDecimal totalPrice = orderCallService
					.getNeedPrePayAmountOfCashBymainOrderId(tradingId);
			// 支付订单
			orderCallService.orderPayRequest(userId, totalPrice, tradingId);

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.PLACE);

			// 修改订单note
			YmatouEasyCall YmatouEasyCall = new YmatouEasyCall("", "POST",
					"JSON");
			OrderBean order = new OrderBean();

			String orderJson = "{\"OrderId\":"
					+ orderId
					+ ",\"UserId\":"
					+ userId
					+ ",\"RemarkContent\":\"修改订单备注01\",\"RemarkLevel\":1,\"RemarkTime\":\"2016-12-26 15:53:01\"}";
			YmatouEasyCall
					.setUrl("http://operate.trading.iapi.ymatou.com/api/Seller/ChangeOrderNote");
			YmatouEasyCall.setData(orderJson);
			YmatouEasyCall.callService();

			syncOrderCmdBean.setCmdReqId(TestDataManager.getRandomUUID()
					.toString());
			syncOrderCmdBean.setOrderId(orderId);

			syncOrderCmdBean.setCommand(OrderSyncCmdEnum.REMARK_LEVEL
					.toString());
			syncOrderCmdCall.setData(syncOrderCmdBean);
			syncOrderCmdCall.callService();

			Logger.verifyIsContains("ok", syncOrderCmdCall.getReturnData(),
					"验证返回结果");

			SyncVerifyService.verify(orderId, userId, sellerId);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_SyncOrderCmd_020() {
		Logger.start(true, "REFUND_APPLY指令调用成功,验证数据");
		try {
			// 创建订单
			Logger.comment("前置数据准备");
			PlaceOrderResp placeOrder = PlaceOrderService.placeOrder3();
			int userId = placeOrder.getUserId();
			int sellerId = placeOrder.getOrderList().get(0).getSellerId();

			int tradingId = placeOrder.getTradingId();
			Integer orderId = placeOrder.getOrderList().get(0).getOrderId();
			Logger.comment("前置数据准备结束");

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.PLACE);

			OrderCallService orderCallService = new OrderCallService();
			// 应付款全金额
			BigDecimal totalPrice = orderCallService
					.getNeedPrePayAmountOfCashBymainOrderId(tradingId);
			// 支付订单
			orderCallService.orderPayRequest(userId, totalPrice, tradingId);

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.PAY);

			// 接单
			orderCallService.acceptOrder(orderId, sellerId);

			// 商家发货
			SyncVerifyService.dispatched(orderId, sellerId);

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.DELIVERY);

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.ACCEPT);

			// 申请退款
			orderCallService.applySalesRefundRequestInJava(orderId);

			syncOrderCmdBean.setCmdReqId(TestDataManager.getRandomUUID()
					.toString());
			syncOrderCmdBean.setOrderId(orderId);

			syncOrderCmdBean.setCommand(OrderSyncCmdEnum.REFUND_APPLY
					.toString());
			syncOrderCmdCall.setData(syncOrderCmdBean);
			syncOrderCmdCall.callService();

			Logger.verifyIsContains("ok", syncOrderCmdCall.getReturnData(),
					"验证返回结果");

			SyncVerifyService.verify(orderId, userId, sellerId);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_SyncOrderCmd_021() {
		Logger.start(true, "REFUND_CHANGE指令调用成功,验证数据");
		try {
			// 创建订单
			Logger.comment("前置数据准备");
			PlaceOrderResp placeOrder = PlaceOrderService.placeOrder3();
			int userId = placeOrder.getUserId();
			int sellerId = placeOrder.getOrderList().get(0).getSellerId();

			int tradingId = placeOrder.getTradingId();
			Integer orderId = placeOrder.getOrderList().get(0).getOrderId();
			Logger.comment("前置数据准备结束");

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.PLACE);

			OrderCallService orderCallService = new OrderCallService();
			// 应付款全金额
			BigDecimal totalPrice = orderCallService
					.getNeedPrePayAmountOfCashBymainOrderId(tradingId);
			// 支付订单
			orderCallService.orderPayRequest(userId, totalPrice, tradingId);

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.PAY);

			// 接单
			orderCallService.acceptOrder(orderId, sellerId);

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.ACCEPT);

			// 商家发货
			SyncVerifyService.dispatched(orderId, sellerId);

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.DELIVERY);

			// 申请退款
			String refundBillNo = orderCallService
					.applySalesRefundRequestInJava(orderId)
					.getSalesRefundInfoList().get(0).getRefundBillNo();

			SyncVerifyService.syncOrderCmd(orderId,
					OrderSyncCmdEnum.REFUND_APPLY);

			// 修改退款申请单
			YmatouEasyCall YmatouEasyCall = new YmatouEasyCall("", "POST",
					"JSON");
			OrderBean order = new OrderBean();

			String orderJson = "{\"OrderId\":"
					+ orderId
					+ ",\"RefundBillNo\":"
					+ refundBillNo
					+ ",\"RefundAmount\":473.00,\"RefundProductNum\":100,\"Reason\":\"123456789\",\"RefundType\":1}";

			YmatouEasyCall
					.setUrl("http://operate.trading.iapi.ymatou.com/api/SalesRefund/ChangeSalesRefundInfo");
			YmatouEasyCall.setData(orderJson);
			YmatouEasyCall.callService();

			syncOrderCmdBean.setCmdReqId(TestDataManager.getRandomUUID()
					.toString());
			syncOrderCmdBean.setOrderId(orderId);

			syncOrderCmdBean.setCommand(OrderSyncCmdEnum.REFUND_CHANGE
					.toString());
			syncOrderCmdCall.setData(syncOrderCmdBean);
			syncOrderCmdCall.callService();

			Logger.verifyIsContains("ok", syncOrderCmdCall.getReturnData(),
					"验证返回结果");

			SyncVerifyService.verify(orderId, userId, sellerId);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_SyncOrderCmd_022() {
		Logger.start(true, "REFUND_REJECT指令调用成功,验证数据");
		try {
			// 创建订单
			Logger.comment("前置数据准备");
			PlaceOrderResp placeOrder = PlaceOrderService.placeOrder3();
			int userId = placeOrder.getUserId();
			int sellerId = placeOrder.getOrderList().get(0).getSellerId();

			int tradingId = placeOrder.getTradingId();
			Integer orderId = placeOrder.getOrderList().get(0).getOrderId();
			Logger.comment("前置数据准备结束");

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.PLACE);

			OrderCallService orderCallService = new OrderCallService();
			// 应付款全金额
			BigDecimal totalPrice = orderCallService
					.getNeedPrePayAmountOfCashBymainOrderId(tradingId);
			// 支付订单
			orderCallService.orderPayRequest(userId, totalPrice, tradingId);

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.PAY);

			// 接单
			orderCallService.acceptOrder(orderId, sellerId);

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.ACCEPT);

			// 商家发货
			SyncVerifyService.dispatched(orderId, sellerId);

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.DELIVERY);

			// 申请退款
			ApplySalesRefundRequestBean applySalesRefundRequestBean = orderCallService
					.applySalesRefundRequestInJava(orderId);

			SyncVerifyService.syncOrderCmd(orderId,
					OrderSyncCmdEnum.REFUND_APPLY);

			// 拒绝退款
			orderCallService
					.salesrefundfailrequest(applySalesRefundRequestBean);

			syncOrderCmdBean.setCmdReqId(TestDataManager.getRandomUUID()
					.toString());
			syncOrderCmdBean.setOrderId(orderId);

			syncOrderCmdBean.setCommand(OrderSyncCmdEnum.REFUND_REJECT
					.toString());
			syncOrderCmdCall.setData(syncOrderCmdBean);
			syncOrderCmdCall.callService();

			Logger.verifyIsContains("ok", syncOrderCmdCall.getReturnData(),
					"验证返回结果");

			SyncVerifyService.verify(orderId, userId, sellerId);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_SyncOrderCmd_023() {
		Logger.start(true, "REFUND_APPROVE指令调用成功,验证数据");
		try {
			// 创建订单
			Logger.comment("前置数据准备");
			PlaceOrderResp placeOrder = PlaceOrderService.placeOrder3();
			int userId = placeOrder.getUserId();
			int sellerId = placeOrder.getOrderList().get(0).getSellerId();

			int tradingId = placeOrder.getTradingId();
			Integer orderId = placeOrder.getOrderList().get(0).getOrderId();
			Logger.comment("前置数据准备结束");

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.PLACE);

			OrderCallService orderCallService = new OrderCallService();
			// 应付款全金额
			BigDecimal totalPrice = orderCallService
					.getNeedPrePayAmountOfCashBymainOrderId(tradingId);
			// 支付订单
			orderCallService.orderPayRequest(userId, totalPrice, tradingId);

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.PAY);

			// 接单
			orderCallService.acceptOrder(orderId, sellerId);

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.ACCEPT);

			// 商家发货
			SyncVerifyService.dispatched(orderId, sellerId);

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.DELIVERY);

			// 申请退款
			ApplySalesRefundRequestBean applySalesRefundRequestBean = orderCallService
					.applySalesRefundRequestInJava(orderId);

			SyncVerifyService.syncOrderCmd(orderId,
					OrderSyncCmdEnum.REFUND_APPLY);

			// 退款成功
			orderCallService
					.salesrefundsuccessrequest(applySalesRefundRequestBean);

			syncOrderCmdBean.setCmdReqId(TestDataManager.getRandomUUID()
					.toString());
			syncOrderCmdBean.setOrderId(orderId);

			syncOrderCmdBean.setCommand(OrderSyncCmdEnum.REFUND_APPROVE
					.toString());
			syncOrderCmdCall.setData(syncOrderCmdBean);
			syncOrderCmdCall.callService();

			Logger.verifyIsContains("ok", syncOrderCmdCall.getReturnData(),
					"验证返回结果");

			SyncVerifyService.verify(orderId, userId, sellerId);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_SyncOrderCmd_024() {
		Logger.start(true, "REFUND_APPROVE 全都退款后取消订单,验证数据");
		try {
			// 创建订单
			Logger.comment("前置数据准备");
			OrderCallService orderCallService = new OrderCallService();
			PlaceOrderResp placeOrderResp = new OrderCallService()
					.createM2cOrder();

			int orderId = placeOrderResp.getOrderList().get(0).getOrderId();
			int sellerId = placeOrderResp.getOrderList().get(0).getSellerId();
			int userId = placeOrderResp.getUserId();
			int tradingId = placeOrderResp.getTradingId();

			Logger.comment("前置数据准备结束");

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.PLACE);

			// 应付款全金额
			BigDecimal totalPrice = orderCallService
					.getNeedPrePayAmountOfCashBymainOrderId(tradingId);
			// 支付订单
			orderCallService.orderPayRequest(userId, totalPrice, tradingId);

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.PAY);

			// 接单
			orderCallService.acceptOrder(orderId, sellerId);

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.ACCEPT);

			// 商家发货
			SyncVerifyService.dispatched(orderId, sellerId);

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.DELIVERY);

			// 申请退款
			ApplySalesRefundRequestBean applySalesRefundRequestBean = orderCallService
					.applySalesRefundRequestInJava(orderId);

			SyncVerifyService.syncOrderCmd(orderId,
					OrderSyncCmdEnum.REFUND_APPLY);

			// 退款成功
			orderCallService
					.salesrefundsuccessrequest(applySalesRefundRequestBean);

			syncOrderCmdBean.setCmdReqId(TestDataManager.getRandomUUID()
					.toString());
			syncOrderCmdBean.setOrderId(orderId);

			syncOrderCmdBean.setCommand(OrderSyncCmdEnum.REFUND_APPROVE
					.toString());
			syncOrderCmdCall.setData(syncOrderCmdBean);
			syncOrderCmdCall.callService();

			Logger.verifyIsContains("ok", syncOrderCmdCall.getReturnData(),
					"验证返回结果");

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.CANCEL);

			SyncVerifyService.verify(orderId, userId, sellerId);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_SyncOrderCmd_025() {
		Logger.start(true, "FREEZE_UNFREEZE指令调用成功,验证数据");
		try {
			// 创建订单
			Logger.comment("前置数据准备");
			PlaceOrderResp placeOrder = PlaceOrderService.placeOrder3();
			int userId = placeOrder.getUserId();
			int sellerId = placeOrder.getOrderList().get(0).getSellerId();

			int tradingId = placeOrder.getTradingId();
			Integer orderId = placeOrder.getOrderList().get(0).getOrderId();
			Logger.comment("前置数据准备结束");

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.PLACE);

			OrderCallService orderCallService = new OrderCallService();
			// 应付款全金额
			BigDecimal totalPrice = orderCallService
					.getNeedPrePayAmountOfCashBymainOrderId(tradingId);
			// 支付订单
			orderCallService.orderPayRequest(userId, totalPrice, tradingId);

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.PAY);

			// 接单
			orderCallService.acceptOrder(orderId, sellerId);

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.ACCEPT);

			// 订单投诉维权
			YmatouEasyCall YmatouEasyCall = new YmatouEasyCall("", "POST",
					"JSON");
			OrderBean order = new OrderBean();
			String orderJson = "{\"OrderId\":" + orderId
					+ ",\"IsFrozen\":true,\"UserId\":" + sellerId + "}";
			YmatouEasyCall
					.setUrl("http://operate.trading.iapi.ymatou.com/api/Common/FrozenOrUnFrozen");
			YmatouEasyCall.setData(orderJson);
			YmatouEasyCall.callService();

			syncOrderCmdBean.setCmdReqId(TestDataManager.getRandomUUID()
					.toString());
			syncOrderCmdBean.setOrderId(orderId);

			syncOrderCmdBean.setCommand(OrderSyncCmdEnum.FREEZE_UNFREEZE
					.toString());
			syncOrderCmdCall.setData(syncOrderCmdBean);
			syncOrderCmdCall.callService();

			Logger.verifyIsContains("ok", syncOrderCmdCall.getReturnData(),
					"验证返回结果");

			SyncVerifyService.verify(orderId, userId, sellerId);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_SyncOrderCmd_026() {
		Logger.start(true, "CHANGE_BILLCODE指令调用成功,验证数据");
		try {
			// 创建订单
			Logger.comment("前置数据准备");
			PlaceOrderResp placeOrder = PlaceOrderService.placeOrder3();
			int userId = placeOrder.getUserId();
			int sellerId = placeOrder.getOrderList().get(0).getSellerId();

			int tradingId = placeOrder.getTradingId();

			Integer orderId = placeOrder.getOrderList().get(0).getOrderId();

			Logger.comment("前置数据准备结束");

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.PLACE);

			OrderCallService orderCallService = new OrderCallService();
			// 应付款全金额
			BigDecimal totalPrice = orderCallService
					.getNeedPrePayAmountOfCashBymainOrderId(tradingId);
			// 支付订单
			orderCallService.orderPayRequest(userId, totalPrice, tradingId);

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.PAY);

			// 接单
			orderCallService.acceptOrder(orderId, sellerId);

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.ACCEPT);
			// 商家发货
			String oldBillCode = SyncVerifyService
					.dispatched(orderId, sellerId);

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.DELIVERY);

			// 订单投诉维权
			YmatouEasyCall YmatouEasyCall = new YmatouEasyCall("", "POST",
					"JSON");
			OrderBean order = new OrderBean();

			String newBillCode = TestDataManager.randomStr(10);

			String orderJson = "{\"SellerId\":" + sellerId + ",\"OrderId\":"
					+ orderId + ",\"BillCodeList\":\"" + newBillCode + "\"}";
			YmatouEasyCall
					.setUrl("http://operate.trading.iapi.ymatou.com/api/Seller/ChangeOrderDeliveryNumber");
			YmatouEasyCall.setData(orderJson);
			YmatouEasyCall.callService();

			SyncVerifyService.modifyDeliverBillCode(orderId, sellerId,
					newBillCode, oldBillCode);

			syncOrderCmdBean.setCmdReqId(TestDataManager.getRandomUUID()
					.toString());

			syncOrderCmdBean.setOrderId(orderId);

			syncOrderCmdBean.setCommand(OrderSyncCmdEnum.CHANGE_BILLCODE
					.toString());

			syncOrderCmdCall.setData(syncOrderCmdBean);
			syncOrderCmdCall.callService();

			Logger.verifyIsContains("ok", syncOrderCmdCall.getReturnData(),
					"验证返回结果");

			SyncVerifyService.verify(orderId, userId, sellerId);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_SyncOrderCmd_027() {
		Logger.start(true, "创建砍价团开团订单,ORDER_BIZ指令调用成功,验证数据");
		try {
			// 创建订单
			Logger.comment("前置数据准备");

			PlaceOrderResp placeOrder = PlaceOrderService.placeOrder1(null);

			int userId = placeOrder.getUserId();

			int sellerId = placeOrder.getOrderList().get(0).getSellerId();

			int tradingId = placeOrder.getTradingId();

			Integer orderId = placeOrder.getOrderList().get(0).getOrderId();

			Logger.comment("前置数据准备结束");

			syncOrderCmdBean.setCmdReqId(TestDataManager.getRandomUUID()
					.toString());

			syncOrderCmdBean.setOrderId(orderId);

			syncOrderCmdBean.setCommand(OrderSyncCmdEnum.ORDER_BIZ.toString());

			syncOrderCmdCall.setData(syncOrderCmdBean);

			syncOrderCmdCall.callService();

			Logger.verifyIsContains("ok", syncOrderCmdCall.getReturnData(),
					"验证返回结果");

			SyncVerifyService.verify(orderId, userId, sellerId);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_SyncOrderCmd_028() {
		Logger.start(true, "创建砍价团参团订单,ORDER_BIZ指令调用成功,验证数据");
		try {
			// 创建订单
			Logger.comment("前置数据准备");

			PlaceOrderResp placeOrder = PlaceOrderService.placeOrder1(null);
			// 团id
			String bizId = placeOrder.getBizId();

			int userId = placeOrder.getUserId();

			int sellerId = placeOrder.getOrderList().get(0).getSellerId();
			// 参团
			PlaceOrderResp placeOrder2 = PlaceOrderService.placeOrder2(bizId);

			int orderId = placeOrder2.getOrderList().get(0).getOrderId();

			Logger.comment("前置数据准备结束");

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.PAY);

			syncOrderCmdBean.setCmdReqId(TestDataManager.getRandomUUID()
					.toString());
			syncOrderCmdBean.setOrderId(orderId);

			syncOrderCmdBean.setCommand(OrderSyncCmdEnum.ORDER_BIZ.toString());
			syncOrderCmdCall.setData(syncOrderCmdBean);
			syncOrderCmdCall.callService();

			Logger.verifyIsContains("ok", syncOrderCmdCall.getReturnData(),
					"验证返回结果");

			SyncVerifyService.verify(orderId, userId, sellerId);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_SyncOrderCmd_029() {
		Logger.start(true, "创建砍价团开团订单,砍价团通知开团成功,ORDER_BIZ指令调用成功,验证数据");
		try {
			// 创建订单
			Logger.comment("前置数据准备");

			PlaceOrderResp placeOrder = PlaceOrderService.placeOrder1(null);

			int userId = placeOrder.getUserId();

			int sellerId = placeOrder.getOrderList().get(0).getSellerId();

			String bizId = placeOrder.getBizId();
			Integer orderId = placeOrder.getOrderList().get(0).getOrderId();

			Logger.comment("前置数据准备结束");

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.PLACE);

			BargainGroupService.notifyOrderBizStatus(bizId, orderId, 1, 1);

			Thread.sleep(2000);

			syncOrderCmdBean.setCmdReqId(TestDataManager.getRandomUUID()
					.toString());
			syncOrderCmdBean.setOrderId(orderId);

			syncOrderCmdBean.setCommand(OrderSyncCmdEnum.ORDER_BIZ.toString());
			syncOrderCmdCall.setData(syncOrderCmdBean);
			syncOrderCmdCall.callService();

			Logger.verifyIsContains("ok", syncOrderCmdCall.getReturnData(),
					"验证返回结果");

			SyncVerifyService.verify(orderId, userId, sellerId);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_SyncOrderCmd_030() {
		Logger.start(true, "创建砍价团参团订单,砍价团通知参团成功,ORDER_BIZ指令调用成功,验证数据");
		try {
			// 创建订单
			Logger.comment("前置数据准备");

			PlaceOrderResp placeOrder = PlaceOrderService.placeOrder1(null);
			// 团id
			String bizId = placeOrder.getBizId();

			int userId = placeOrder.getUserId();

			int sellerId = placeOrder.getOrderList().get(0).getSellerId();
			// 参团
			PlaceOrderResp placeOrder2 = PlaceOrderService.placeOrder2(bizId);

			int orderId = placeOrder2.getOrderList().get(0).getOrderId();

			Logger.comment("前置数据准备结束");

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.PAY);

			BargainGroupService.notifyOrderBizStatus(bizId, orderId, 2, 2);

			Thread.sleep(2000);

			syncOrderCmdBean.setCmdReqId(TestDataManager.getRandomUUID()
					.toString());
			syncOrderCmdBean.setOrderId(orderId);

			syncOrderCmdBean.setCommand(OrderSyncCmdEnum.ORDER_BIZ.toString());
			syncOrderCmdCall.setData(syncOrderCmdBean);
			syncOrderCmdCall.callService();

			Logger.verifyIsContains("ok", syncOrderCmdCall.getReturnData(),
					"验证返回结果");

			SyncVerifyService.verify(orderId, userId, sellerId);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_SyncOrderCmd_031() {
		Logger.start(true, "创建砍价团参团订单,砍价团通知组团成功,ORDER_BIZ指令调用成功,验证数据");
		try {
			// 创建订单
			Logger.comment("前置数据准备");

			PlaceOrderResp placeOrder = PlaceOrderService.placeOrder1(null);
			// 团id
			String bizId = placeOrder.getBizId();

			int userId = placeOrder.getUserId();

			int sellerId = placeOrder.getOrderList().get(0).getSellerId();
			// 参团
			PlaceOrderResp placeOrder2 = PlaceOrderService.placeOrder2(bizId);

			int orderId = placeOrder2.getOrderList().get(0).getOrderId();

			Logger.comment("前置数据准备结束");

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.PAY);

			BargainGroupService.notifyOrderBizStatus(bizId, orderId, 2, 3);

			Thread.sleep(2000);

			syncOrderCmdBean.setCmdReqId(TestDataManager.getRandomUUID()
					.toString());
			syncOrderCmdBean.setOrderId(orderId);

			syncOrderCmdBean.setCommand(OrderSyncCmdEnum.ORDER_BIZ.toString());
			syncOrderCmdCall.setData(syncOrderCmdBean);
			syncOrderCmdCall.callService();

			Logger.verifyIsContains("ok", syncOrderCmdCall.getReturnData(),
					"验证返回结果");

			SyncVerifyService.verify(orderId, userId, sellerId);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_SyncOrderCmd_032() {
		Logger.start(true, "创建砍价团参团订单,砍价团通知组团失败,ORDER_BIZ指令调用成功,验证数据");
		try {
			// 创建订单
			Logger.comment("前置数据准备");

			PlaceOrderResp placeOrder = PlaceOrderService.placeOrder1(null);
			// 团id
			String bizId = placeOrder.getBizId();

			int userId = placeOrder.getUserId();

			int sellerId = placeOrder.getOrderList().get(0).getSellerId();
			// 参团
			PlaceOrderResp placeOrder2 = PlaceOrderService.placeOrder2(bizId);

			int orderId = placeOrder2.getOrderList().get(0).getOrderId();

			Logger.comment("前置数据准备结束");

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.PAY);

			BargainGroupService.notifyOrderBizStatus(bizId, orderId, 2, -3);

			Thread.sleep(4000);

			syncOrderCmdBean.setCmdReqId(TestDataManager.getRandomUUID()
					.toString());
			syncOrderCmdBean.setOrderId(orderId);

			syncOrderCmdBean.setCommand(OrderSyncCmdEnum.ORDER_BIZ.toString());
			syncOrderCmdCall.setData(syncOrderCmdBean);
			syncOrderCmdCall.callService();

			Logger.verifyIsContains("ok", syncOrderCmdCall.getReturnData(),
					"验证返回结果");

			SyncVerifyService.verify(orderId, userId, sellerId);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_SyncOrderCmd_033() {
		Logger.start(true, "创建多商品订单包含直播商品和现货商品,验证数据");
		try {
			// 创建订单
			Logger.comment("前置数据准备");

			PlaceOrderResp placeOrder = PlaceOrderService.placeOrder3();

			int userId = placeOrder.getUserId();
			int sellerId = placeOrder.getOrderList().get(0).getSellerId();
			int tradingId = placeOrder.getTradingId();
			Integer orderId = placeOrder.getOrderList().get(0).getOrderId();

			Logger.comment("前置数据准备结束");

			Thread.sleep(2000);

			syncOrderCmdBean.setCmdReqId(TestDataManager.getRandomUUID()
					.toString());
			syncOrderCmdBean.setOrderId(orderId);

			syncOrderCmdBean.setCommand(OrderSyncCmdEnum.PLACE.toString());
			syncOrderCmdCall.setData(syncOrderCmdBean);
			syncOrderCmdCall.callService();

			Logger.verifyIsContains("ok", syncOrderCmdCall.getReturnData(),
					"验证返回结果");

			SyncVerifyService.verify(orderId, userId, sellerId);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_SyncOrderCmd_034() {
		Logger.start(true, "创建多商品订单包含直播商品和现货商品,调整折扣跟运费后，验证数据");
		try {
			// 创建订单
			Logger.comment("前置数据准备");

			PlaceOrderResp placeOrder = PlaceOrderService
					.placeOrderWithOutCoupon();

			int userId = placeOrder.getUserId();
			int sellerId = placeOrder.getOrderList().get(0).getSellerId();
			int tradingId = placeOrder.getTradingId();
			Integer orderId = placeOrder.getOrderList().get(0).getOrderId();

			SyncVerifyService.changeOrderDiscount(orderId, sellerId);

			Logger.comment("前置数据准备结束");

			Thread.sleep(2000);

			syncOrderCmdBean.setCmdReqId(TestDataManager.getRandomUUID()
					.toString());
			syncOrderCmdBean.setOrderId(orderId);

			syncOrderCmdBean.setCommand(OrderSyncCmdEnum.CHANGE_DISCOUNT
					.toString());
			syncOrderCmdCall.setData(syncOrderCmdBean);
			syncOrderCmdCall.callService();

			Logger.verifyIsContains("ok", syncOrderCmdCall.getReturnData(),
					"验证返回结果");

			SyncVerifyService.verify(orderId, userId, sellerId);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_SyncOrderCmd_035() {
		Logger.start(true, "DELIVERY_TYPE 修改物流类型,验证数据");
		try {
			// 创建订单
			Logger.comment("前置数据准备");

			PlaceOrderResp placeOrderResp = PlaceOrderService
					.placeOrderWithOutCoupon();

			int orderId = placeOrderResp.getOrderList().get(0).getOrderId();
			int sellerId = placeOrderResp.getOrderList().get(0).getSellerId();
			int userId = placeOrderResp.getUserId();
			int tradingId = placeOrderResp.getTradingId();

			Logger.comment("前置数据准备结束");

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.PLACE);

			SyncVerifyService.changeLogisticsType(orderId, sellerId,
					LogisticsTypeEnum.US);

			syncOrderCmdBean.setCmdReqId(TestDataManager.getRandomUUID()
					.toString());
			syncOrderCmdBean.setOrderId(orderId);

			syncOrderCmdBean.setCommand(OrderSyncCmdEnum.DELIVERY_TYPE
					.toString());
			syncOrderCmdCall.setData(syncOrderCmdBean);
			syncOrderCmdCall.callService();

			Logger.verifyIsContains("ok", syncOrderCmdCall.getReturnData(),
					"验证返回结果");

			SyncVerifyService.verify(orderId, userId, sellerId);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_SyncOrderCmd_036() {

		Logger.start(true, "第三方支付,PAY指令调用成功,验证数据");
		try {
			// 创建订单
			Logger.comment("前置数据准备");
			PlaceOrderResp placeOrder = PlaceOrderService.placeOrder3();
			int userId = placeOrder.getUserId();
			int sellerId = placeOrder.getOrderList().get(0).getSellerId();

			int tradingId = placeOrder.getTradingId();

			BigDecimal price = placeOrder.getPayAmount();

			Integer orderId = placeOrder.getOrderList().get(0).getOrderId();
			Logger.comment("前置数据准备结束");

			SyncVerifyService.syncOrderCmd(orderId, OrderSyncCmdEnum.PLACE);

			OrderCallService orderCallService = new OrderCallService();

			// 13 为 app国际支付宝，15 微信
			String payType = "13";
			int thirdTradingId = new OrderCallService().orderPayRequest(userId,
					BigDecimal.ZERO, tradingId, payType);
			// 支付网关支付回调交易

			PaymentProxyCallService.notifyCall(payType,
					String.valueOf(thirdTradingId), price.toString(), userId);

			Thread.sleep(3000);

			syncOrderCmdBean.setCmdReqId(TestDataManager.getRandomUUID()
					.toString());
			syncOrderCmdBean.setOrderId(orderId);

			syncOrderCmdBean.setCommand(OrderSyncCmdEnum.PAY.toString());
			syncOrderCmdCall.setData(syncOrderCmdBean);
			syncOrderCmdCall.callService();

			Logger.verifyIsContains("ok", syncOrderCmdCall.getReturnData(),
					"验证返回结果");

			SyncVerifyService.verify(orderId, userId, sellerId);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_SyncOrderCmd_037() {

		Logger.start(true, "订单商品不包邮,申请退款及退运费,验证数据");
		try {
			PlaceOrderResp placeOrderResp = SettlementService
					.placeOrder2(false);

			Order order = placeOrderResp.getOrderList().get(0);

			int orderId = order.getOrderId();
			int userId = placeOrderResp.getUserId();
			int tradingId = placeOrderResp.getTradingId();
			int sellerId = order.getSellerId();
			BigDecimal payAmount = placeOrderResp.getPayAmount();

			OrderCallService orderCallService = new OrderCallService();

			// 支付订单
			orderCallService.orderPayRequest(userId, payAmount, tradingId);
			// 接单
			orderCallService.acceptOrder(orderId, sellerId);
			// 发货
			SyncVerifyService.dispatched(orderId, sellerId);

			// 部分退款

			OrderInfoPo orderInfoPo1 = order.getOrderInfoList().get(0);
			OrderInfoPo orderInfoPo2 = order.getOrderInfoList().get(1);

			BigDecimal partRefund1 = SettlementService
					.calcRealPayAmountOnProduct(orderInfoPo1.getOrderInfoId())
					.add(BigDecimal.ONE);

			BigDecimal partRefund2 = SettlementService
					.calcRealPayAmountOnProduct(orderInfoPo2.getOrderInfoId())
					.add(BigDecimal.ONE);

			ApplySalesRefundRequestBean applySalesRefundRequestBean = orderCallService
					.applySalesRefundRequestInJavaBean(orderId);

			applySalesRefundRequestBean.getSalesRefundInfoList().remove(2);

			applySalesRefundRequestBean.getSalesRefundInfoList().get(0)
					.setRefundAmount(partRefund1);

			applySalesRefundRequestBean.getSalesRefundInfoList().get(1)
					.setRefundAmount(partRefund2);

			orderCallService
					.applySalesRefundRequestCall(applySalesRefundRequestBean);
			//退款执行
			orderCallService
					.salesrefundsuccessrequest(applySalesRefundRequestBean);

			Thread.sleep(2000);

			syncOrderCmdBean.setCmdReqId(TestDataManager.getRandomUUID()
					.toString());
			syncOrderCmdBean.setOrderId(orderId);

			syncOrderCmdBean.setCommand(OrderSyncCmdEnum.REFUND_APPLY
					.toString());
			syncOrderCmdCall.setData(syncOrderCmdBean);
			syncOrderCmdCall.callService();

			Logger.verifyIsContains("ok", syncOrderCmdCall.getReturnData(),
					"验证返回结果");

			SyncVerifyService.verify(orderId, userId, sellerId);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_SyncOrderCmd_038() {
		Logger.start(true, "含有组合商品的订单下单成功,验证数据");
		try {
			// 创建订单
			Logger.comment("前置数据准备");

			PlaceOrderResp placeOrder = PlaceOrderService.placeOrder10();

			int userId = placeOrder.getUserId();
			int sellerId = placeOrder.getOrderList().get(0).getSellerId();
			Integer orderId = placeOrder.getOrderList().get(0).getOrderId();

			Logger.comment("前置数据准备结束");
			Thread.sleep(2000);

			syncOrderCmdBean.setCmdReqId(TestDataManager.getRandomUUID()
					.toString());
			syncOrderCmdBean.setOrderId(orderId);

			syncOrderCmdBean.setCommand(OrderSyncCmdEnum.UPDATE_PRODUCT
					.toString());
			syncOrderCmdCall.setData(syncOrderCmdBean);
			syncOrderCmdCall.callService();

			Logger.verifyIsContains("ok", syncOrderCmdCall.getReturnData(),
					"验证返回结果");

			SyncVerifyService.verify(orderId, userId, sellerId);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_SyncOrderCmd_039() {
		Logger.start(true, "含有组合商品的订单下单,使用招行支付,验证数据");
		try {
			// 创建订单
			Logger.comment("前置数据准备");

			PlaceOrderResp placeOrder = PlaceOrderService.placeOrder10();

			int userId = placeOrder.getUserId();
			int sellerId = placeOrder.getOrderList().get(0).getSellerId();
			Integer orderId = placeOrder.getOrderList().get(0).getOrderId();
			int tradingId = placeOrder.getTradingId();

			Logger.comment("前置数据准备结束");

			// 获取用户需要支付的金额
			BigDecimal totalPrice = new OrderCallService()
					.getNeedPrePayAmountOfCashBymainOrderId(tradingId);

			BigDecimal blanceAmout = BigDecimal.ZERO;

			OrderPayRequestBean orderpayrequestbean = new OrderPayRequestBean();
			OrderPayRequestCall orderpayrequestcall = new OrderPayRequestCall();

			// 参数
			orderpayrequestbean.setCallBackUrl("www.ymtautotest.com");
			orderpayrequestbean.setUserId(userId);
			orderpayrequestbean.setUseAccountAmount(blanceAmout);
			orderpayrequestbean.setTradingId(tradingId);
			String tradingPassword = "abc123";
			orderpayrequestbean.setTradingPwd(tradingPassword);
			orderpayrequestbean.setUserIp("127.0.0.10");
			orderpayrequestbean.setBankId("123");
			orderpayrequestbean.setPayType("50");
			orderpayrequestbean.setUsePlatform(PlatformEnum.SHANGOU_WAP
					.getValue());
			orderpayrequestbean.setParamExt("");
			orderpayrequestbean.setMemo("备注");
			// 发送请求
			orderpayrequestcall.setData(false, orderpayrequestbean);
			orderpayrequestcall.callService();

			String thirdTradingId = orderpayrequestcall.getData().getString(
					"tradingId");

			// 支付网关支付回调交易
			String cmbDiscountAmount = PaymentProxyCallService.cmbNotifyCall(
					String.valueOf(thirdTradingId),
					totalPrice.subtract(blanceAmout).toString(), userId);

			Logger.comment("前置数据准备结束");
			Thread.sleep(5000);

			syncOrderCmdBean.setCmdReqId(TestDataManager.getRandomUUID()
					.toString());
			syncOrderCmdBean.setOrderId(orderId);

			syncOrderCmdBean.setCommand(OrderSyncCmdEnum.PAY.toString());
			syncOrderCmdCall.setData(syncOrderCmdBean);
			syncOrderCmdCall.callService();

			Logger.verifyIsContains("ok", syncOrderCmdCall.getReturnData(),
					"验证返回结果");

			SyncVerifyService.verify(orderId, userId, sellerId);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_SyncOrderCmd_040() {
		Logger.start(true, "含有组合商品的订单后,调整运费，折扣,验证数据");
		try {
			// 创建订单
			Logger.comment("前置数据准备");

			PlaceOrderResp placeOrder = placeOrder2();

			Thread.sleep(2000);

			int userId = placeOrder.getUserId();
			int sellerId = placeOrder.getOrderList().get(0).getSellerId();
			Integer orderId = placeOrder.getOrderList().get(0).getOrderId();

			// 参数
			BigDecimal discount = new BigDecimal(28);

			ChangeOrderDiscountBean changeorderdiscountbean = new ChangeOrderDiscountBean();
			ChangeOrderDiscountCall changeorderdiscountcall = new ChangeOrderDiscountCall();

			changeorderdiscountbean.setDiscount(discount);
			String discountTime = YMTDateUtil.getSysTime();
			changeorderdiscountbean.setDiscountTime(discountTime);

			changeorderdiscountbean.setFreight(new BigDecimal(30));
			changeorderdiscountbean.setOrderId(orderId);
			changeorderdiscountbean.setSellerId(sellerId);
			// 发送请求
			changeorderdiscountcall.setData(false, changeorderdiscountbean);
			changeorderdiscountcall.callService();

			Logger.comment("前置数据准备结束");
			Thread.sleep(2000);

			syncOrderCmdBean.setCmdReqId(TestDataManager.getRandomUUID()
					.toString());
			syncOrderCmdBean.setOrderId(orderId);

			syncOrderCmdBean.setCommand(OrderSyncCmdEnum.CHANGE_DISCOUNT
					.toString());
			syncOrderCmdCall.setData(syncOrderCmdBean);
			syncOrderCmdCall.callService();

			Logger.verifyIsContains("ok", syncOrderCmdCall.getReturnData(),
					"验证返回结果");

			SyncVerifyService.verify(orderId, userId, sellerId);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}